﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Zj.BaiduPicSpider.Sys.EnumExtension
{
    /// <summary>
    /// 枚举扩展方法
    /// </summary>
    public static class EnumExt
    {
        /// <summary>
        /// 获取该枚举所有的字段说明
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public static  List<EnumValueModel> GetEnumModels<T>(this T t)
             where T : struct
        {
          return  EnumHelper<T>.GetEnumModels();
        }


        /// <summary>
        /// 获取枚举某字段的说明
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <param name="name"></param>
        /// <returns></returns>

        public static EnumValueModel GetEnumModel<T>(this T t, string name)
             where T : struct
        {
            return EnumHelper<T>.GetEnumModel(name);
        }
    }

}
